<?php
class ConsumptionAction extends CommonAction {
    public function __construct(){
		parent::__construct();
		
		$this->modelObject = D('ConsumptionView');
    }
   
    public function index(){
		$thisPage = $this->pageInfo['p'] = I('p', 1);
		
		if($this->pageInfo['id'] = I('id', '')){
			$where['Consumption.id'] = $this->pageInfo['id'];
			$where['Member.username'] = array('LIKE', '%'.$this->pageInfo['id'].'%');
			$where['_logic'] = 'or';
			$map['_complex'] = $where;
		}
		
		if($this->pageInfo['status'] = I('status', '')){
			$map['status'] = $this->pageInfo['status'];
		}
		
		//获得列表
		$list = $this->modelObject->getPageList($map, $thisPage);
		//p($this->modelObject->_sql());
		//分页
		$page = $this->modelObject->buildPage($map, $thisPage);
		$this->assign('page',$page);
		
		session('pageInfo', $this->pageInfo);
		$this->assign('pageInfo', $this->pageInfo);
		$this->assign('list', $list);
		$this->display();
    }
}